package com.yiidata.rpc.hrpc;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ipc.VersionedProtocol;

import java.net.InetSocketAddress;

/**
 * <pre>
 *
 * Created by zhenqin.
 * User: zhenqin
 * Date: 2018/1/6
 * Time: 11:48
 * Verdor: NowledgeData
 * To change this template use File | Settings | File Templates.
 *
 * </pre>
 *
 * @author zhenqin
 */
public class HadoopRpcHelloWorldClient {


    public static void main(String[] args) throws Exception {
        String hostName = "localhost";
        int port = 8088;

        InetSocketAddress inetSocketAddress = new InetSocketAddress(hostName, port);
        HadoopRpcProtocol proxy = RPC.getProxy(HadoopRpcProtocol.class,
                1L,
                inetSocketAddress,
                new Configuration());

        Message message = proxy.sayHello(new User("HadoopRPC"));
        System.out.println(message.getHi());

    }
}
